package HeSuanServer.controller;

import HeSuanServer.POJO.R.Result;
import HeSuanServer.POJO.Employee;
import HeSuanServer.POJO.User;
import HeSuanServer.service.EmpCliService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @描述:
 * @author: LH
 * @date: 2023/2/16
 */
@RestController
@CrossOrigin
@RequestMapping("empcli")
@Slf4j
public class empCliController {
    @Autowired
    EmpCliService empCliService;
    @PostMapping("code")
    public Result code(String msg){
        log.info(msg);
        return empCliService.code(msg);
    }
    @PostMapping("login")
    public Result login(@RequestBody Employee emp){
        return empCliService.login(emp);
    }
    @GetMapping("login")
    public Result getlogin(Integer id,String password){
        Employee employee=new Employee();
        employee.setId(id);
        employee.setPassword(password);
        return empCliService.login(employee);
    }
    @GetMapping("updatemm")
    public Result updatemm(String password,Integer id){
        return empCliService.updatemm(password,id);
    }
    @GetMapping("pickid")
    public Result getPickId(String pipId, String ms){
        return empCliService.getPickById(pipId,ms);
    }
    @GetMapping("luru")
    public Result luru(Integer uid,String ms,Integer empId,String pipId){
        return empCliService.luru(uid,ms,empId,pipId);
    }
    @GetMapping("userById")
    public Result userById(Integer uid){
        return empCliService.userById(uid);
    }
    @GetMapping("jilu")
    public Result jilu(Integer empId){
        return empCliService.jilu(empId);
    }
    @PostMapping("sd")
    public Result sd(@RequestBody User user,@RequestParam(name = "ms") String ms,@RequestParam(name = "empId") Integer empId,@RequestParam(name = "pipId") String pipId){
        return empCliService.sd(user,ms,empId,pipId);
    }
}
